summaryrefslogtreecommitdiff
path: root/src/routes/posts/[slug]/+page.svelte
blob: af3e78b6126af48864d7a08b211d2335fed36071 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script lang="ts">
  import type { PageData } from "./$types";
  import Giscus from "$lib/components/Giscus.svelte";

  let { data }: { data: PageData } = $props();

  function formatDate(dateStr: string): string {
    return new Date(dateStr).toLocaleDateString("en-US", {
      year: "numeric",
      month: "long",
      day: "numeric",
    });
  }
</script>

<svelte:head>
  <title>{data.metadata.title} | wenekar sucks at programming</title>
  <meta name="description" content={data.metadata.description} />
</svelte:head>

<article>
  <header>
    <h1>{data.metadata.title}</h1>
    <p>
      <time datetime={data.metadata.date}>{formatDate(data.metadata.date)}</time
      >
    </p>
  </header>

  <data.content />
</article>

<Giscus />

<a href="/">← Back to all posts</a>